/* eslint-disable */
const HtmlWebpackPlugin = require("html-webpack-plugin")
const {resolve} = require("path")
module.exports = {
    entry: "./src/index.js",
    output: {
        filename: "js/built.js",
        path: resolve(__dirname, "build")
    },
    module: {
        rules: [
            /**
             * 语法检查 eslint-loader,eslint
             * 注意：只检查自己的源代码，不检查第三方库
             * 设置检查规则
             * 在package.josn中的eslintConfig中设置
             *   "eslintConfig": {
                    "extends": "airbnb-base"
                  }
             * 推介使用airbnb-->eslint-config-airbnb-base eslint-plugin-import eslint
             */
            {
                test: /\.js$/,
                loader: "eslint-loader",
                enforce: "pre", // 编译前检查
                exclude: /node_modules/, // 不检测的文件
                include:[resolve(__dirname,"src")],
                options: {
                    //自动修复eslint错误
                    fix: true
                }
            }
        ]
    },
    plugins: [
        new HtmlWebpackPlugin({
            template: "./src/index.html"
        })
    ],
    mode: "development"
}
